<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <div class="Showroom-parent" v-if="props.info.digitalShowroom">
      <digitalShowroomInfo :url="props.info.digitalShowroom" :id="props.info.id" />
    </div>
    <img class="outline-parent-bg" :src="publicUrls + 'free/style8/Level1outlineStyle2Bg.webp'" alt="" />
    <div
      class="outline"
      :style="!props.info.value && !props.info.subTitle && !props.info.remarks && { justifyContent: 'center' }"
    >
      <div
        class="outline-content"
        :class="!props.info.value && !props.info.subTitle && !props.info.remarks && 'content-tiitle-height'"
      >
        <div class="content-tiitle" v-html="textType(props.info.text)"></div>
        <div class="outline-subTitle" v-if="props.info.subTitle">
          <img :src="publicUrls + 'free/style8/Level1outlineSubtitleBg.png?imageView2/3/format/webp'" alt="" />
          {{ props.info.subTitle }}
          <img :src="publicUrls + 'free/style8/Level1outlineSubtitleBg.png?imageView2/3/format/webp'" alt="" />
        </div>
      </div>
      <TextMax
        :class="!props.info.value && 'subtitleMargin'"
        :data="props.info.remarks"
        :title="props.info.text"
        :infoData="props.info"
        :row="
          props.info.value
            ? 6
            : !props.info.value && props.info.subTitle
            ? 7
            : !props.info.value && !props.info.subTitle && 11
        "
      ></TextMax>
      <div class="cover" :class="!props.info.value && 'cover-height'">
        <div class="cover-box" v-if="props.info.value">
          <img
            class="outline-cover"
            @click="ImgVisible = true"
            :src="urls + props.info.value + '?imageView2/3/format/webp'"
            alt=""
          />
        </div>
        <img class="outline-cover" v-else :src="publicUrls + 'free/style8/Level1outlineRound2.png'" alt="" />
        <img class="outline-bg" :src="publicUrls + 'free/style8/Level1outlineRound1.png'" />
      </div>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style8/firstLevelOutline1Shadow.png'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free8Style2',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { computed, defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import digitalShowroomInfo from '@/freeComponents/unitdigitalShowroom/style8.vue';
import { useProjectStore } from '@/store';

const ImgVisible = ref(false);
const store = useProjectStore();
const title = ref();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};

const titleSlice = computed(() => {
  let title: string;
  if (props.info.text?.length > 4) {
    if (props.info.text?.length <= 9) {
      title = props.info.text.slice(-2);
    } else {
      title = props.info.text.slice(-4);
    }
  }
  return title;
});
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-left: 120px;
  margin-top: 0;
  .shadow {
    width: 874px;
    height: 248px;
    position: absolute;
    bottom: -30px;
    left: -45px;
  }
  .Showroom-parent {
    position: absolute;
    top: 30px;
    right: 23px;
    z-index: 21;
  }
}
.outline-parent-bg {
  width: 626px;
  height: 100%;
  position: relative;
  z-index: 20;
}
.outline {
  position: absolute;
  top: -0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: start;
  width: 100%;
  height: 840px;
  padding: 102px 190px 72px 180px;
  overflow: hidden;
}
.outline-content {
  display: flex;
  align-items: center;
  justify-content: start;
  flex-direction: column;
  width: 100%;
}
.content-tiitle-height {
  padding-bottom: 110px;
}
.content-tiitle {
  width: 256px;
  height: 94px;
  border-top: rgba(79, 110, 92, 1) solid 1px;
  border-bottom: rgba(79, 110, 92, 1) solid 1px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 12px;
  ::v-deep p {
    color: #4f6e5c;
    font-family: 'SourceHanSerifCN-Bold';
    font-size: 32px;
    line-height: 40px;
    text-align: center;
  }
}
.outline-subTitle {
  width: 256px;
  color: rgba(79, 110, 92, 0.5);
  text-align: center;
  font-family: 'SourceHanSerifCN';
  font-size: 18px;
  line-height: 24px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: rgba(79, 110, 92, 1) solid 1px;

  img {
    width: 16px;
    height: 16px;
    animation: rotate 4s linear infinite;
    &:first-child {
      margin-right: 12px;
    }
    &:last-child {
      margin-left: 12px;
    }
  }
}
::v-deep .subtitleMargin {
  margin-top: 68px;
}
.cover-height {
  width: 400px !important;
  height: 400px !important;
  position: absolute !important;
  bottom: -205px;
  left: 48%;
  transform: translate(-48%, 0);
  padding: 34px !important;
}
.cover {
  width: 280px;
  height: 280px;
  padding: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 24px;
  position: relative;
  .cover-box {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    &:hover .outline-cover {
      transform: scale(1.2);
    }
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: all 0.5s;
  }
  .outline-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: rotate 15s linear infinite;
    @keyframes rotate {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }
  }
}
::v-deep .textMore-box {
  margin-bottom: 24px;
  flex: 1;
}

::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.59) !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #345746 !important;
  font-weight: 500 !important;
  text-decoration-line: underline;
}
</style>